﻿using System;
using MIXer.Core.Extensions;
using System.ComponentModel;

namespace MIXer.Core.Domain
{
    public class Session : INotifyPropertyChanged
    {
        #region Fields
        private string _eventCode;
        private string _sessionCode;
        private string _abstract;
        private string _title;
        private Uri _videoUrl;
        private long _length;
        private string _author;
        #endregion

        #region Events
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region Methods
        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
        #endregion

        #region Properties
        public string Author
        {
            get { return _author; }
            set
            {
                _author = value;
                NotifyPropertyChanged("Author");
            }
        }
        public string EventCode
        {
            get { return _eventCode; }
            set
            {
                _eventCode = value;
                NotifyPropertyChanged("EventCode");
            }
        }
        public string SessionCode
        {
            get { return _sessionCode; }
            set
            {
                _sessionCode = value;
                NotifyPropertyChanged("SessionCode");
            }
        }
        public string Abstract
        {
            get { return _abstract; }
            set
            {
                _abstract = value;
                NotifyPropertyChanged("Abstract");
            }
        }
        public string Title
        {
            get { return _title; }
            set
            {
                _title = value;
                NotifyPropertyChanged("Title");
            }
        }
        public Uri VideoUrl
        {
            get { return _videoUrl; }
            set
            {
                _videoUrl = value;
                NotifyPropertyChanged("VideoUrl");
            }
        }
        public long Length
        {
            get { return _length; }
            set
            {
                _length = value;
                NotifyPropertyChanged("Length");
                NotifyPropertyChanged("FriendlyLength");
            }
        }
        public string FriendlyLength 
        {
            get { return Length.ToFriendlySize(); }
        }
        #endregion
    }
}
